function [prediction,confidence ] = gpr_wo_noise_online(kernel_handle,training_data,class)
%GPR_WO_NOISE - implemetns a gpr assuming no noise in o/p variable.
%   Detailed explanation goes here

mx = mean(training_data(:,6:end),1);
sx = var(training_data(:,6:end));
%sx = max(whole_data);


training_data(:,6:end) = bsxfun(@minus, training_data(:,6:end), mx);
training_data(:,6:end) = bsxfun(@rdivide, training_data(:,6:end), sx);
training_data(:,end) = 0;





y = 10*(training_data(:,5) == class);
y(y==0) = -10;
%known_negative_features = data(nc_data(nc_ind),6:end);




prediction = zeros(size(test_data,1),1);
confidence = zeros(size(test_data,1),1);


for i=1:size(test_data,1)-1
    i
    feature_cov = kernel_handle(training_data(1:i,6:end),training_data(1:i,6:end));
    feature_inv_output = (feature_cov\y(1:i));
    kxt_xd = kernel_handle(training_data(i+1,6:end),training_data(1:i,6:end));
    mean_value = kxt_xd*feature_inv_output;
    %cov = kernel_handle(data(i,6:end),data(i,6:end)) - kxt_xd*(feature_cov\kxt_xd');
    prediction(i) = (mean_value>0);
    if(training_data(i+1,5)==class) 
        if (prediction(i)>0)
            prediction(i)=1;
        else
            prediction(i)=0;
        end
    else
        if (prediction(i)<0)
            prediction(i)=1;
        else
            prediction(i)=0;
        end
    end
    
    confidence(i) = 1;
end
prediction = [0,prediction];
confidence = [0,confidence];
end




